#!/bin/bash
#安装openjdk8
#2022-06-21

#卸载jdk
rpm -qa | grep java
rpm -qa | grep jdk
rpm -qa | grep jdk | xargs rpm -e --nodeps
rpm -qa | grep java | xargs rpm -e --nodeps

#下载安装openjdk8
wget --no-check-certificate https://download.java.net/openjdk/jdk8u41/ri/openjdk-8u41-b04-linux-x64-14_jan_2020.tar.gz
tar -zxf openjdk-8u41-b04-linux-x64-14_jan_2020.tar.gz -C /opt/

echo '
export JAVA_HOME=/opt/java-se-8u41-ri
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
' >> /etc/profile
source /etc/profile
java -version